package contacts.view;
import javax.swing.*;

import contacts.controller.ContactsControllerListener;

import java.awt.*;   //导入必要的包

public class LogIn extends JFrame{
    JTextField jTextField ;
    JPasswordField jPasswordField;
    JLabel jLabel1,jLabel2;  
    JLabel jb01,jb02;  
    JPanel jp1,jp2,jp3;
    JButton jb1,jb2; 
    ContactsControllerListener controllerListener;
    public LogIn(){
	   controllerListener=new ContactsControllerListener();
	  controllerListener.setDenglu(this);
       jTextField = new JTextField(12);
       jPasswordField = new JPasswordField(13);       
        jLabel1 = new JLabel("用户名");
        jLabel2 = new JLabel("密码");        
        ImageIcon addIcon1 = new ImageIcon(ContactsFrame.class.getResource("/LogInName.jpg"));
        jb01=new JLabel(addIcon1);
        ImageIcon addIcon2 = new ImageIcon(ContactsFrame.class.getResource("/LogInPassWord.jpg"));
        jb02=new JLabel(addIcon2);       
        jb1 = new JButton("确认");
        jb1.addActionListener(controllerListener);
        jb1.setActionCommand("确认");	  
        jb2 = new JButton("取消");
        jb2.addActionListener(controllerListener);
        jb2.setActionCommand("取消");	       
        jp1 = new JPanel();
        jp2 = new JPanel();
        jp3 = new JPanel();         
        this.setLayout(new GridLayout(3,1));        
        jp1.add(jb01);
        jp1.add(jLabel1); 
        jp1.add(jTextField);       
        jp2.add(jb02);
        jp2.add(jLabel2);
        jp2.add(jPasswordField);                 
        jp3.add(jb1);
        jp3.add(jb2);       
        this.add(jp1);
        this.add(jp2);
        this.add(jp3);   
        this.setBounds(600,300,400,400);
        this.setBackground(Color.PINK);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setVisible(true);
        this.setTitle("登录");        
   }
     
public JTextField getjTextField() {
	return jTextField;
}

public JPasswordField getjPasswordField() {
	return jPasswordField;
   }
}

